import {defineStore} from 'pinia'
import Basic from './models/public/Basic.js'
// let basicValue = Basic.parse({});
// let basicValue2 = Basic.parse({
//     source: "2017-06-09T00:00:00+08:00",
//     salary: 10000,
//     rate: 0.1
// });
// let basicValue3 = Basic.dispose({
//     id: null,
//     source: "2017-06-09",
//     description: null,
//     tags: [],
//     companyId: null,
//     rate: "0.1",
//     salary: 10
// });
// console.log('basicValue.parse',basicValue)
// console.log('basicValue2.parse',basicValue2)
// console.log('basicValue3.dispose',basicValue3)
import {
    noticeList,
    newsList,
    yanboList
} from '../api/mock/mock_public.js'

// console.log('notice',noticeList)
export const useResultPub = defineStore('result-public', {
    state: () => {
        return {
            count: 10,
            name: 'xx',
            noticeList: noticeList.rows,
            newsList: newsList.rows,
            yanboList: yanboList.rows,
        }
    },
    getters: {
        doubleCount: (state) => state.count * 2,
        doublePlusOne: (state) => {
            return state.doubleCount + '-ss'
        }
    },
    actions: {
        increment() {
            this.count++
        },
        asyncIncrement() {
            setTimeout(() => this.count++, 1000)
        },
        async insertPost(data) {
            // 可以做异步
            // await doAjaxRequest(data);
            // this.name = data;
        },
    }
})
